import * as React from 'react';
import { Component } from 'react';
import { View, Text, StyleSheet } from 'react-native';

import BackUp from '@/components/backUp';
import { WebView } from 'react-native-webview';

class Test extends Component {
	render() {
		const { goBack } = this.props.navigation;
		return (
			<View style={styles.my}>
				<BackUp title="测试页面" goBack={goBack} />
				<Text>测试一下</Text>
				<WebView
					originWhitelist={['*']}
					source={{ html: '<h1>1111</h1>' }}
					style={{ width: '100%', height: 100, backgroundColor: 'transparent' }}
					scalesPageToFit={true}
					onError={() => {
						console.log('error');
					}}
					onLoad={() => {
						console.log('success');
					}}
					renderLoading={() => {
						return (
							<View>
								<Text>这是自定义Loading...</Text>
							</View>
						);
					}}
				/>
			</View>
		);
	}
}

const styles = StyleSheet.create({
	my: {
		fontSize: 14,
		height: '100%',
	},
});

export default Test;
